package com.ruoyi.project.other.paycost.controller;

import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.other.cost.domain.Cost;
import com.ruoyi.project.other.cost.domain.CostData;
import com.ruoyi.project.other.paycost.service.PayCostService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 管理费缴纳
 */
@Controller
@RequestMapping("/other/paycost")
public class PayCostController extends BaseController {

    private String prefix = "other/paycost";

    @Autowired
    private PayCostService payCostService;

    @RequiresPermissions("other:paycost:view")
    @GetMapping("")
    public String cost(){
        return prefix+"/paycost";
    }

    /**
     * 多条件查询管理费
     * @return
     */
    @RequiresPermissions("other:paycost:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo findCost(){
        startPage();
        Cost cost = new Cost();
        List<Cost> list = payCostService.findCost(cost);
        return getDataTable(list);
    }

    @RequiresPermissions("other:paycost:list")
    @PostMapping("/findDate")
    @ResponseBody
    public CostData findDate(){
        CostData costData = payCostService.findData();
        return costData;
    }

}
